package com.naodong.shenluntiku.mvp.view.adapter;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.naodong.shenluntiku.R;
import com.naodong.shenluntiku.mvp.model.bean.Analysis;
import com.naodong.shenluntiku.util.ImageLoaderUtil;

import java.util.List;

/**
 * Created by hujie on 17/4/21.
 *
 * 范文 解析列表适配器
 */

public class AnalysisListAdapter extends BaseQuickAdapter<Analysis, BaseViewHolder> {
    public AnalysisListAdapter(int layoutId, List<Analysis> data) {
        super(layoutId, data);
    }

    public AnalysisListAdapter(int layoutId) {
        super(layoutId, null);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, Analysis articleAnalysis) {


        baseViewHolder.setText(R.id.titleTV, articleAnalysis.getTitle())
                .setText(R.id.timeTV, articleAnalysis.getTime());


        if (TextUtils.isEmpty(articleAnalysis.getListImgLink())) {
            articleAnalysis.setListImgLink("");
        }

        ImageLoaderUtil.loadImage(mContext,articleAnalysis.getListImgLink(),baseViewHolder.getView(R.id.imageIV));

    }
}
